import { ApiProperty } from '@nestjs/swagger';
import { FavoriteTypes } from 'src/core/dtos/favorite.dto';

export class CommonPaginationReqDto {
  @ApiProperty({
    description: '页码',
  })
  page: number;

  @ApiProperty({
    description: '条数',
  })
  size: number;
}

export class CommonPaginationResDto {
  @ApiProperty({
    description: '总数',
  })
  total: number;

  @ApiProperty({
    description: '条数',
  })
  current: number;

  @ApiProperty({
    description: '列表',
  })
  list: [];
}

export class AuthLoginReqDto {
  @ApiProperty({
    description: '手机号码',
  })
  phone: string;

  @ApiProperty({
    description: '登录密码',
  })
  password: string;
}

export class AuthLoginResDto {
  @ApiProperty({
    description: '登录凭证',
  })
  token: string;
}

export class AuthQuickReqDto {
  @ApiProperty({
    description: '手机号码',
  })
  phone: string;

  @ApiProperty({
    description: '短信验证码',
    maxLength: 6,
    minLength: 6,
  })
  code: string;
}

export class AuthQuickResDto extends AuthLoginResDto {}

export class AuthWechatReqDto {
  @ApiProperty({
    description:
      '`wx.login`获取的`code`参数,服务端调用微信`code2Session接口`获取其他参数',
  })
  code: string;
}
export class AuthWechatResDto extends AuthLoginResDto {}

export class AuthDouyinReqDto {
  @ApiProperty({
    description: '',
  })
  encryptedData: string;

  @ApiProperty({
    description: '',
  })
  iv: string;

  @ApiProperty({
    description: '`wx.login`获取的`code`参数',
  })
  code: string;
}
export class AuthDouyinResDto extends AuthLoginResDto {}

export class AuthKwaiReqDto {
  @ApiProperty({
    description: '`wx.login`获取的`code`参数',
  })
  code: string;
}
export class AuthKwaiResDto extends AuthLoginResDto {}

export class AuthRegReqDto {
  @ApiProperty({
    description: '手机号码',
  })
  phone: string;

  @ApiProperty({
    description: '短信验证码',
  })
  code: string;

  @ApiProperty({
    description: '登录密码',
  })
  password: string;
}

export class AuthRegResDto extends AuthLoginResDto {}

export class AuthForgetReqDto extends AuthRegReqDto {}

export class AuthForgetResDto extends AuthLoginResDto {}

export class FavoriteAddReqDto {
  @ApiProperty({
    description: '收藏类型',
    enum: FavoriteTypes,
  })
  type: FavoriteTypes;

  @ApiProperty({
    description: '资源ID',
  })
  resource: number;
}
